<?php
/**
 * 功能：用户管理控制器
 * 作者：张大海 jhlforever@foxmail.com
 * 时间：2019-9-2 22:33
 */
defined('BASEPATH') OR exit('No direct script access allowed');
require_once 'application/controllers/BaseController.php';

class UserManage extends BaseController
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('mp_user');

    }

    //用户管理-列表
    public function index()
    {
//        if(count(array_intersect(array('admin', 'group_admin'), $this->userObj->roleArray)) == 0){
//            $this->error_page('404', '错误信息', '找不到您所要的页面！！！', array());
//            return;
//        }
        $data = array();
        $data['actTab'] = 'usermanage';
        $data["bcList"] = '<li><i class="fa fa-angle-right"></i><span>用户管理</span></li>';
        $content = $this->load->view('UserManage/user_manage', $data, TRUE);
        $cssScriptExtra = '<link rel="stylesheet" href="/public/global/plugins/bootstrap-table/bootstrap-table.min.css"/>';
        $cssScriptExtra .= '<link rel="stylesheet" href="/public/global/plugins/bootstrapvalidator/css/bootstrapValidator.min.css"/>';
        $jsScriptExtra = '<script type="text/javascript" src="/public/global/plugins/bootstrap-table/bootstrap-table.js"></script>';
        $jsScriptExtra .= '<script type="text/javascript" src="/public/global/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>';
        $jsScriptExtra .= '<script type="text/javascript" src="/public/global/plugins/bootstrapvalidator/js/bootstrapValidator.min.js"></script>';
        $jsScriptExtra .= '<script type="text/javascript" src="/public/global/plugins/bootstrapvalidator/js/language/zh_CN.js"></script>';
        $jsScriptExtra .= '<script type="text/javascript" src="/public/global/js/md5.js"></script>';
        $jsScriptExtra .= '<script type="text/javascript" src="/public/UserManage/js/usermanage.js"></script>';
        $this->mp_main->Show_Portal($content, $cssScriptExtra, '用户管理', $data, $jsScriptExtra);
    }

    public function getUserList()
    {
        $limit = $this->input->get('limit');
        $offset = $this->input->get('offset');
        $userRole = $this->input->get('serUserRole');
        $gender = $this->input->get('serGender');
        $fullName = $this->input->get('serFullName');
        $mobile = $this->input->get('serMobile');
        header('Content-type: application/json');
        $jsonRet = array();
        $jsonRet['ret'] = 0;
        $count = User::Get_UserCount();
        $userList = User::Get_UserList($limit, $offset);
        $jsonRet['rows'] = $userList;
        $jsonRet['total'] = $count;
        echo json_encode($jsonRet);

    }

}